Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Feb 8, 2026

Implements POST /v1/projects/{owner}/{project}/transfer-ownership to allow project owners to transfer ownership to another user.

Changes

Database

  • Added TransferProjectOwnership SQL query updating projects.owner and users_projects atomically

API

  • New endpoint with request model accepting new_owner_handle
  • Returns old/new owner handles and project metadata
  • Authorization: owner-only via existing auth middleware

Validation

  • New owner must exist and differ from current owner
  • Prevents conflicts: new owner cannot already have project with same handle
  • Handles edge case: if new owner was previously shared (editor/reader), role is upgraded to owner

Transaction flow

// Atomic:
// 1. UPDATE projects SET owner = new_owner
// 2. DELETE FROM users_projects WHERE user = old_owner  
// 3. DELETE FROM users_projects WHERE user = new_owner (if exists)
// 4. INSERT INTO users_projects (new_owner, project_id, role='owner')

Tests
10 test cases covering: nonexistent project/user, self-transfer, unauthorized access, handle conflicts, successful transfers, and post-transfer access verification.

Documentation
Added README section with usage examples and behavioral notes (old owner loses access, embeddings remain intact).

Original prompt

Add an endpoint, model, handler, tests and documentation for a function that allows the owner of a project to transfer ownership to another user. Maybe the same (and optionally in one go) for other resources like definitions, instances etc...


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 4 commits February 8, 2026 16:56
Co-authored-by: awagner-mainz <2088443+awagner-mainz@users.noreply.github.com>
Co-authored-by: awagner-mainz <2088443+awagner-mainz@users.noreply.github.com>
Co-authored-by: awagner-mainz <2088443+awagner-mainz@users.noreply.github.com>
Co-authored-by: awagner-mainz <2088443+awagner-mainz@users.noreply.github.com>
Copilot AI changed the title [WIP] Add endpoint for transferring project ownership to another user Add project ownership transfer endpoint Feb 8, 2026
Copilot AI requested a review from awagner-mainz February 8, 2026 17:03
@awagner-mainz awagner-mainz marked this pull request as ready for review February 8, 2026 17:18
@awagner-mainz
Copy link
Contributor

Looks good.

@awagner-mainz awagner-mainz merged commit e1a7264 into main Feb 8, 2026
1 check failed
@awagner-mainz awagner-mainz deleted the copilot/add-transfer-ownership-endpoint branch February 8, 2026 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants